﻿#region License
// (c) Intergen.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
#endregion

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace TextGlow.Control.Controls
{
  public struct UVSize
  {
    private double _u;
    private double _v;
    private Orientation _orientation;

    public double U
    {
      get { return _u; }
      set { _u = value; }
    }

    public double V
    {
      get { return _v; }
      set { _v = value; }
    }

    public double Width
    {
      get
      {
        if (_orientation != Orientation.Horizontal)
          return _v;

        return _u;
      }
      set
      {
        if (_orientation == Orientation.Horizontal)
          _u = value;
        else
          _v = value;
      }
    }

    public double Height
    {
      get
      {
        if (_orientation != Orientation.Horizontal)
          return _u;

        return _v;
      }
      set
      {
        if (_orientation == Orientation.Horizontal)
          _v = value;
        else
          _u = value;
      }
    }

    public Size Size
    {
      get { return new Size(Width, Height); }
    }

    public UVSize(Orientation orientation, Size size)
      : this(orientation, size.Width, size.Height)
    {
    }

    public UVSize(Orientation orientation, double width, double height)
    {
      _u = _v = 0.0;
      _orientation = orientation;
      Width = width;
      Height = height;
    }

    public UVSize(Orientation orientation)
    {
      _u = _v = 0.0;
      _orientation = orientation;
    }
  }
}